package com.xtaller.sdboot.config.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author : Taller
 * @date : 2020/2/29 15:23
 * @Description : 拦截配置
 */
@Configuration
public class Config implements WebMvcConfigurer {
    @Resource private BasicFilter basicFilter;
    @Resource private TokenFilter tokenFilter;
    @Resource private PermissionFilter permissionFilter;
    @Resource private LoginFilter loginFilter;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(basicFilter).addPathPatterns("/v*/**");
        registry.addInterceptor(loginFilter).addPathPatterns("/v*/**");
        registry.addInterceptor(tokenFilter).addPathPatterns("/v*/**");
        registry.addInterceptor(permissionFilter).addPathPatterns("/v*/**");
    }
}
